package com.scs.application.modules.sys.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.scs.application.core.mapper.IBaseMapper;
import com.scs.application.modules.sys.dto.UserSelectDTO;
import com.scs.application.modules.sys.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

@Repository
public interface UserMapper extends IBaseMapper<User> {
    IPage<HashMap<String,Object>> getUserList(Page page, @Param(Constants.WRAPPER) Wrapper wrapper);
    @Select("SELECT id,parent_id,name,0 AS type FROM sys_office UNION SELECT id,office_id AS parent_id,name,1 AS type FROM sys_user")
    List<UserSelectDTO> getUserTree();
}
